package br.com.bringme.mvc;

import java.util.HashMap;

public class Params extends HashMap<String, Object> {

	private static final long serialVersionUID = 7027777074883970306L;
	
	public HashMap<String, Object> asMap() {
		return this;
	}
	
	public void set(String key, Object value) {
		put(key, value);
	}
	
	public boolean has(String key) {
		return containsKey(key);
	}
	
	public boolean hasValue(Object value) {
		return containsValue(value);
	}
	
	public void unset(String key) {
		this.remove(key);
	}
	
	@SuppressWarnings("unchecked")
	public <T> T get(String key, T defaultValor) {
		T value = (T) super.get(key);
		
		if( value == null) {
			return defaultValor;
		}
		
		return value;
	}
	
	public <T> T get(String key) {
		return get(key, null);
	}
	

}
